package com.zjj3;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.LogManager;

public class JCLJULTest {
    public static Log log=LogFactory.getLog(JCLJULTest.class);


    static {
        LogManager logManager = LogManager.getLogManager();
        InputStream asStream = JCLJULTest.class.getClassLoader().getResourceAsStream("logging.properties");
        try {
            File file = new File("");
            System.out.println(file.getAbsolutePath());

            logManager.readConfiguration(asStream);

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static String test(String msg) {
        // 记录debug级别的信息
        log.debug(log.getClass().getName()+" This is debug message."+msg);
        // 记录info级别的信息
        log.info(log.getClass().getName()+" This is info message."+msg);
        // 记录error级别的信息
        log.error(log.getClass().getName()+" This is error message."+msg);
        return "";
    }
}
